package com.mallcloud.mall.common.core.constant.enums.mall;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 积分券
 */
@Getter
@AllArgsConstructor
public enum PointsCouponEnum {

	//字典
	REDEEM_STATUS("REDEEM_STATUS", "积分券字典"),
	;

	private final String type;
	private final String description;

	@Getter
	@AllArgsConstructor
	public enum TypeEnum {
		TYPE_1("I", ""),
		TYPE_2("C", ""),
		TYPE_3("D", ""),
		;
		private String type;
		private String description;

		public static String getDecs(Integer type) {
			return Arrays.stream(values()).filter(x -> x.getType().equals(type)).findFirst().get().getDescription();
		}
	}

	@Getter
	@AllArgsConstructor
	public enum PurposeEnum {
		PAY(1, "买券"),
		FREE(2, "领券"),
		REDEEM(3, "积分兑换券"),
		;
		private Integer code;
		private String description;

		public static String getDecs(Integer code) {
			return Arrays.stream(values()).filter(x -> x.getCode().equals(code)).findFirst().get().getDescription();
		}
	}

	@Getter
	@AllArgsConstructor
	public enum StatusEnum {
		Y("可用券"),
		N("不可用券"),
		;
		private String description;

		public static String getDecs(Integer type) {
			return Arrays.stream(values()).filter(x -> x.name().equals(type)).findFirst().get().getDescription();
		}
	}
}
